//
//  KZVideoClickView.m
//  听说弱点强化训练
//
//  Created by 朱凯 on 2018/9/4.
//  Copyright © 2018年 盛超. All rights reserved.
//

#import "KZVideoClickView.h"

@implementation KZVideoClickView
{
    UIImageView *_cameraView;
}


- (instancetype)init {
    if (self = [super init]) {
        self.backgroundColor = [UIColor colorWithR:129 g:225 b:175 a:1];
        self.layer.masksToBounds = true;
        
        [self setupUI];
    }
    return self;
}
- (void)layoutSubviews {
    
    [super layoutSubviews];
    self.layer.cornerRadius = self.width / 2;
    //测试
}
- (void)setupUI {
    
    UILabel *label = [[UILabel alloc] init];
    label.adjustsFontSizeToFitWidth = true;
    label.text = @"发音图解";
    label.font = FONT(12);
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor whiteColor];
    [self addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_centerY).offset(10);
        make.centerX.equalTo(@0);
    }];
    
    _cameraView = [UIImageView new];
    _cameraView.image = [UIImage imageNamed:@"kz-摄像机"];
    [self addSubview:_cameraView];
    [_cameraView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.centerY.equalTo(self).offset(-5);
    }];
}

- (void)startAnimation {
    
    _cameraView.alpha = 0;
    _cameraView.transform = CGAffineTransformMakeTranslation(0, -50);
    [UIView animateWithDuration:0.5 delay:0.1 usingSpringWithDamping:0.4 initialSpringVelocity:0 options:0 animations:^{
        _cameraView.alpha = 1;
        _cameraView.transform = CGAffineTransformIdentity;
    } completion:^(BOOL finished) {
        
    }];
}

@end
